package patern;

import patern.exceptions.IllegalActionForLeaf;
import engine.expression.Expression;
import engine.expression.Operators;

public class Leaf implements Patern
{
	private String name;
	private double value;
	
	public Leaf(String name)
	{
		this.name = name;
	}
	
	public Leaf(double value)
	{
		this.value = value;
	}
	
	@Override
	public Patern left()
	{
		throw new IllegalActionForLeaf();
	}

	@Override
	public Patern right()
	{
		throw new IllegalActionForLeaf();
	}

	@Override
	public Operators operator()
	{
		throw new IllegalActionForLeaf();
	}

	@Override
	public String name()
	{
		return name;
	}
	
	@Override
	public double value()
	{
		return value;
	}

	@Override
	public boolean isLeaf()
	{
		return true;
	}

	@Override
	public boolean match(Expression exp)
	{
		return false;
	}

}
